  

import { axios } from '@/service/service'
import { ListReq, ProjectsReq, UserIdReq, UpdateProjectsReq } from './types'



// 查询master列表
export function findMasters(
  params: any,
): any {
  return axios({
    url: `/api-scheduler/master/findMasters`,
    method: 'get',
    params
  })
}


// 修改master节点描述
export function updateDesc(
  params: any,
): any {
  return axios({
    url: `/api-scheduler/master/updateDesc`,
    method: 'get',
    params
  })
}

// 修改master节点名称
export function updateName(
  params: any,
): any {
  return axios({
    url: `/api-scheduler/master/updateName`,
    method: 'get',
    params
  })
}

// 删除master节点
export function deleteMasterNode(
  params: any,
): any {
  return axios({
    url: `/api-scheduler/master/delete`,
    method: 'get',
    params
  })
}



// ----------------- 分割线 ---

export function queryProjectListPaging(params: ListReq): any {
  return axios({
    url: '/projects',
    method: 'get',
    params
  })
}

export function createProject(data: ProjectsReq): any {
  return axios({
    url: '/projects',
    method: 'post',
    data
  })
}

export function queryAuthorizedProject(params: UserIdReq): any {
  return axios({
    url: '/projects/authed-project',
    method: 'get',
    params
  })
}

export function queryProjectCreatedAndAuthorizedByUser(): any {
  return axios({
    url: '/projects/created-and-authed',
    method: 'get'
  })
}

export function queryAllProjectList(): any {
  return axios({
    url: '/projects/list',
    method: 'get'
  })
}

export function queryUnauthorizedProject(params: UserIdReq): any {
  return axios({
    url: '/projects/unauth-project',
    method: 'get',
    params
  })
}

export function queryProjectByCode(code: number): any {
  return axios({
    url: `/projects/${code}`,
    method: 'get'
  })
}

export function updateProject(data: UpdateProjectsReq, code: number): any {
  return axios({
    url: `/projects/${code}`,
    method: 'put',
    data
  })
}

export function deleteProject(code: number): any {
  return axios({
    url: `/projects/${code}`,
    method: 'delete'
  })
}

export function queryAllProjectListForDependent(): any {
  return axios({
    url: '/projects/list-dependent',
    method: 'get'
  })
}

